<!DOCTYPE html >
<html lang="zh-CN">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
        <title>示例页面</title>
        <link rel="stylesheet" href="./common/mui/mui.css" />
        <link rel="stylesheet" href="./common/common.css" />
    </head>

    <body>

        <div class="mui-content pt0">
            <ul class="mui-table-view ">
                <li class="mui-table-view-cell">
                    <a class="mui-navigate-right api-class" id="close">关闭本页面(并穿参数)</a>
                </li>
                <li class="mui-table-view-cell">
                    <a class="mui-navigate-right api-class" id="close2">关闭本页面(兼容传参1)</a>
                </li>
                <li class="mui-table-view-cell">
                    <a class="mui-navigate-right api-class" id="close3">关闭本页面(兼容传参2)</a>
                </li>
            </ul>
        </div>
        <script type="text/javascript" src="./common/mui/mui.js"></script>
        <script type="text/javascript" src="../dist/quick.js"></script>
        <script type="text/javascript" src="./../dist/quick.native.js"></script>
        <script type="text/javascript" src="./../dist/quick.h5.js"></script>
        <script type="text/javascript" src="./common/common.js"></script>
        <script>
            window.runApi = function(id) {
                console.log('执行API:' + id);

                switch (id) {
                    case 'close':
                        // 传过去会自动转为字符串
                        quick.page.close({
                            resultData: {
                                key1: 'value2'
                            }
                        });
                        break;
                    case 'close2':
                        // 只允许字符串
                        quick.page.close(JSON.stringify({
                            key1: 'value2'
                        }));
                        break;
                    case 'close3':
                        quick.page.close('value2');
                        break;
                    default:
                        console.error('错误！没有相应API');
                }
            };
        </script>

    </body>

</html>